import { defineStore } from 'pinia'
import * as _ from 'lodash'

const useTabs = defineStore('routerHistory', {
  state: () => {
    return {
      tabsList: [],
    }
  },
  getters: {
    getTabs() {
      return this.tabsList
    }
  },
  actions: {
    addTabe(tab) {
      // 判断是否已经存在,如果不存在,才放入
      if(this.tabsList.some(item => item.path === tab.path) || !tab) return;
      this.tabsList.push(tab)
      
    }
  },
})

export default useTabs
